﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="View.aspx.cs" Inherits="View" %>
<%@ Import Namespace="System.Linq" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="slider">
   <%
       BieumauDataContext db=new BieumauDataContext();
        string query = Request.QueryString["mode"];
       
       
        if (query == "VB")
        {
           int IDvb = Convert.ToInt32(Request.QueryString["vanban"].ToString());
           var vb=(from p in db.tblVanBans where p.IDVanBan==IDvb select p).Single();
           string query_encode = QueryStringModule.Encrypt("http://mothaiba.byethost8.com/wp-content/uploads/2012/12/guice.pdf");//thay url vao day 
           string date = vb.NgayDang.Value.ToString("dd-MMM-yyyy"); 
           Response.Write(" <div id='info_title'>" +
               " <span class='text_title'>NỘI DUNG VĂN BẢN BÁO CÁO THỐNG KÊ KH-CN</span>" +
            "</div>" +
           " <div id='post_wrapper'>" +
               " <div class='post_news'>" +
                  "  <div class='post_title'><a style='font:400 18px/16px Arial;color: #2b2b85;display: inline-block;'>"
+ vb.TieuDe + "</a>" +
                    "</div>" +
                    "<div class='post_content'>" + vb.NoiDungTomTat + "<span class='download'><a href='"+vb.URL+"'><img src='images/download.png' width='20' height='20' alt='Tải ở đây'>  Tải về</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Preview.aspx" + query_encode + "'><img src='images/icons/readme.png' width='20' height='20' alt='Tải ở đây'> Xem chi tiết online</a></span></p>" +
                    "</div>" +
               " </div>" +
          "  </div>" +
           " <div id='view_more'>" +
              "  <div id='title_view_more' >" +
               "     <h5>Các văn bản khác</h5>" +
              "  </div>" +
               " <div id='view_more_content'>" +
                 "   <div id='view_more_items'>" );

           int  tin = db.tblVanBans.Count();
           Random ran = new Random();
           int take_news=5;
           int get_news = ran.Next(0, Math.Abs(tin - take_news));
           var vb1=from p in db.tblVanBans.Skip(get_news).Take(take_news) select p;
           foreach(var v in vb1)
           {
           string d = v.NgayDang.Value.ToString("dd-MMM-yyyy");
           Response.Write("<div class='items_view'> <a href='View.aspx?mode=VB&vanban=" + v.IDVanBan + "'>" + v.TieuDe + "</a><span class='date_post'>(" + d + ")</span></div>");
           }

            Response.Write("</div></div>" +
           " </div>");
      }
        if (query == "BT")
        {
            int IDbt = Convert.ToInt32(Request.QueryString["bantin"].ToString());
            var vb = (from p in db.tblBanTins where p.IDTin == IDbt select p).Single();
            string query_encode = QueryStringModule.Encrypt("http://mothaiba.byethost8.com/wp-content/uploads/2012/12/guice.pdf");//thay url vao day 
            string date = vb.NgayDang.Value.ToString("dd-MMM-yyyy");
            Response.Write(" <div id='info_title'>" +
                " <span class='text_title'>NỘI DUNG THÔNG TIN HOẠT ĐỘNG BÁO CÁO KH-CN</span>" +
             "</div>" +
            " <div id='post_wrapper'>" +
                " <div class='post_news'>" +
                   "  <div class='post_title'><a style='font:400 18px/16px Arial;color: #2b2b85;display: inline-block;'>"
 + vb.TieuDe + "</a>" +
                     "</div>" +
                     "<div class='post_content'>" + vb.NoiDung+
                     "</div>" +
                " </div>" +
           "  </div>" +
            " <div id='view_more'>" +
               "  <div id='title_view_more' >" +
                "     <h5>Các bản tin khác</h5>" +
               "  </div>" +
                " <div id='view_more_content'>" +
                  "   <div id='view_more_items'>");

            int tin = db.tblBanTins.Count();
            Random ran = new Random();
            int take_news = 5;
            int get_news = ran.Next(0,Math.Abs(tin - take_news));
            var vb1 = from p in db.tblBanTins.Skip(get_news).Take(take_news) select p;
            foreach (var v in vb1)
            {
              
                Response.Write("<div class='items_view'><a href='View.aspx?mode=BT&bantin=" + v.IDTin + "'>" + v.TieuDe + "</a></div>");
            }

            Response.Write("</div></div>" +
           " </div>");
        }
      
      
      
       %> 
   
    </div>
</asp:Content>   


 
    
      
         

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>

